package com.example.mybatisregistry.util;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;

/**
 * mybatis工具类
 *
 * @author 27013
 **/


public class MybatisUtil {
    public static SqlSession createSession() throws IOException {
       return new SqlSessionFactoryBuilder().build(
                Resources.getResourceAsReader("mybatis-config.xml")
        ).openSession(true);
    }
}
